using System;
using System.Collections.Generic;
using System.IO;

namespace Lottery.Client.SL
{
    public class MsgInfos
    {
        public static List<MsgInfo> Infos;
        public MsgInfos()
        {
            MsgInfos.Infos = new List<MsgInfo>();
        }
        public static void AddMsgInfos(byte[] datas)
        {
            if (datas == null || datas.Length <= 0)
            {
                return;
            }
            MemoryStream memoryStream = new MemoryStream(datas);
            BinaryReader binaryReader = new BinaryReader(memoryStream);
            while (binaryReader.BaseStream.Position < binaryReader.BaseStream.Length)
            {
                MsgInfo msgInfo = new MsgInfo();
                msgInfo.Title = binaryReader.ReadString();
                msgInfo.Content = binaryReader.ReadString();
                msgInfo.MsgTime = Convert.ToDateTime(binaryReader.ReadString());
                MsgInfos.Infos.Add(msgInfo);
            }
            binaryReader.Close();
            memoryStream.Close();
        }
    }
}